/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Web_service_simulation;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author sabrina
 */
@Entity
@Table(name = "bookings")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Bookings.findAll", query = "SELECT b FROM Bookings b"),
    @NamedQuery(name = "Bookings.findByIdBooking", query = "SELECT b FROM Bookings b WHERE b.idBooking = :idBooking"),
    @NamedQuery(name = "Bookings.findByBookingState", query = "SELECT b FROM Bookings b WHERE b.bookingState = :bookingState"),
    @NamedQuery(name = "Bookings.findByBookingCreationDate", query = "SELECT b FROM Bookings b WHERE b.bookingCreationDate = :bookingCreationDate"),
    @NamedQuery(name = "Bookings.findByBookedPersonsNumber", query = "SELECT b FROM Bookings b WHERE b.bookedPersonsNumber = :bookedPersonsNumber"),
    @NamedQuery(name = "Bookings.findByBookingCreationTime", query = "SELECT b FROM Bookings b WHERE b.bookingCreationTime = :bookingCreationTime"),
    @NamedQuery(name = "Bookings.findByHonored", query = "SELECT b FROM Bookings b WHERE b.honored = :honored"),
    @NamedQuery(name = "Bookings.findByBookingDate", query = "SELECT b FROM Bookings b WHERE b.bookingDate = :bookingDate"),
    @NamedQuery(name = "Bookings.findByBookingType", query = "SELECT b FROM Bookings b WHERE b.bookingType = :bookingType"),
    @NamedQuery(name = "Bookings.findByPresentPersonsNumber", query = "SELECT b FROM Bookings b WHERE b.presentPersonsNumber = :presentPersonsNumber"),
    @NamedQuery(name = "Bookings.findByBookingTime", query = "SELECT b FROM Bookings b WHERE b.bookingTime = :bookingTime")})
public class Bookings implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_booking")
    private Integer idBooking;
    @Size(max = 40)
    @Column(name = "booking_state")
    private String bookingState;
    @Column(name = "booking_creation_date")
    @Temporal(TemporalType.DATE)
    private Date bookingCreationDate;
    @Column(name = "booked_persons_number")
    private Integer bookedPersonsNumber;
    @Column(name = "booking_creation_time")
    @Temporal(TemporalType.TIME)
    private Date bookingCreationTime;
    @Column(name = "honored")
    private Boolean honored;
    @Column(name = "booking_date")
    @Temporal(TemporalType.DATE)
    private Date bookingDate;
    @Size(max = 20)
    @Column(name = "booking_type")
    private String bookingType;
    @Column(name = "present_persons_number")
    private Integer presentPersonsNumber;
    @Column(name = "booking_time")
    @Temporal(TemporalType.TIME)
    private Date bookingTime;
    @ManyToMany(mappedBy = "bookingsCollection")
    private Collection<Contacts> contactsCollection;

    public Bookings() {
    }

    public Bookings(Integer idBooking) {
        this.idBooking = idBooking;
    }

    public Integer getIdBooking() {
        return idBooking;
    }

    public void setIdBooking(Integer idBooking) {
        this.idBooking = idBooking;
    }

    public String getBookingState() {
        return bookingState;
    }

    public void setBookingState(String bookingState) {
        this.bookingState = bookingState;
    }

    public Date getBookingCreationDate() {
        return bookingCreationDate;
    }

    public void setBookingCreationDate(Date bookingCreationDate) {
        this.bookingCreationDate = bookingCreationDate;
    }

    public Integer getBookedPersonsNumber() {
        return bookedPersonsNumber;
    }

    public void setBookedPersonsNumber(Integer bookedPersonsNumber) {
        this.bookedPersonsNumber = bookedPersonsNumber;
    }

    public Date getBookingCreationTime() {
        return bookingCreationTime;
    }

    public void setBookingCreationTime(Date bookingCreationTime) {
        this.bookingCreationTime = bookingCreationTime;
    }

    public Boolean getHonored() {
        return honored;
    }

    public void setHonored(Boolean honored) {
        this.honored = honored;
    }

    public Date getBookingDate() {
        return bookingDate;
    }

    public void setBookingDate(Date bookingDate) {
        this.bookingDate = bookingDate;
    }

    public String getBookingType() {
        return bookingType;
    }

    public void setBookingType(String bookingType) {
        this.bookingType = bookingType;
    }

    public Integer getPresentPersonsNumber() {
        return presentPersonsNumber;
    }

    public void setPresentPersonsNumber(Integer presentPersonsNumber) {
        this.presentPersonsNumber = presentPersonsNumber;
    }

    public Date getBookingTime() {
        return bookingTime;
    }

    public void setBookingTime(Date bookingTime) {
        this.bookingTime = bookingTime;
    }

    @XmlTransient
    public Collection<Contacts> getContactsCollection() {
        return contactsCollection;
    }

    public void setContactsCollection(Collection<Contacts> contactsCollection) {
        this.contactsCollection = contactsCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idBooking != null ? idBooking.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Bookings)) {
            return false;
        }
        Bookings other = (Bookings) object;
        if ((this.idBooking == null && other.idBooking != null) || (this.idBooking != null && !this.idBooking.equals(other.idBooking))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Bookings[ idBooking=" + idBooking + " ]";
    }
    
}
